using System;
using System.Collections.Generic;
using CLZ.Common;
using Shc.Sql;
namespace CLZ.Data
{
	[Serializable]
	public class ViewHomeProduct
		: BaseViewHomeProduct
	{		
		/// <summary>
        /// 根据条件查询单个实体
        /// </summary>
        /// <returns></returns>
        public static ViewHomeProduct Find(params Criterion[] criteria)
        {
            using (DbSession ss = DbManager.Current.OpenSession())
            {
                return DbManager.Current.Find<ViewHomeProduct>(criteria);
            }
        }
		
		/// <summary>
        /// 根据条件查询单个实体
        /// </summary>
        /// <returns></returns>
        public static ViewHomeProduct Find(DbSession ss,params Criterion[] criteria)
        {
			return DbManager.Current.Find<ViewHomeProduct>(ss,criteria);
        }

		/// <summary>
        /// 根据主键查询实体
        /// </summary>
		/// <param name="keys"></param>
        /// <returns></returns>
        public static ViewHomeProduct FindByPK(params object[] keys)
        {
            using (DbSession ss = DbManager.Current.OpenSession())
            {
                return DbManager.Current.FindPK<ViewHomeProduct>(ss, keys);
            }
        }
		
		/// <summary>
        /// 根据主键查询实体
        /// </summary>
		/// <param name="keys"></param>
        /// <returns></returns>
        public static ViewHomeProduct FindByPK(DbSession ss,params object[] keys)
        {
            return DbManager.Current.FindPK<ViewHomeProduct>(ss, keys);
        }
		
		/// <summary>
        /// 根据条件查询
        /// </summary>
		/// <param name="orders"></param>
        /// <param name="criteria"></param>
        /// <returns></returns>
        public static IList<ViewHomeProduct> FindAll(Order[] orders, params Criterion[] criteria)
        {
            IList<ViewHomeProduct> list=new List<ViewHomeProduct>();
            using (DbSession ss = DbManager.Current.OpenSession())
            {
                DbManager.Current.Query(ss, list, orders, criteria);
                return list;
            }
        }
		
		/// <summary>
        /// 根据条件查询
        /// </summary>
		/// <param name="orders"></param>
        /// <param name="criteria"></param>
        /// <returns></returns>
        public static IList<ViewHomeProduct> FindAll(params Criterion[] criteria)
        {
			return FindAll(new Order[0],criteria);
		}
		
		/// <summary>
        /// 根据条件查询
        /// </summary>
		/// <param name="orders"></param>
        /// <param name="criteria"></param>
        /// <returns></returns>
        public static IList<ViewHomeProduct> FindAll(Order[] orders,DbSession ss, params Criterion[] criteria)
        {
            IList<ViewHomeProduct> list=new List<ViewHomeProduct>();
            
            DbManager.Current.Query(ss, list, orders, criteria);
            return list;
        }
		
		/// <summary>
        /// 根据条件查询
        /// </summary>
		/// <param name="orders"></param>
        /// <param name="criteria"></param>
        /// <returns></returns>
        public static IList<ViewHomeProduct> FindAll(DbSession ss,params Criterion[] criteria)
        {
			return FindAll(new Order[0],ss,criteria);
		}
		
		/// <summary>
        /// 根据条件分页查询
        /// </summary>
        /// <param name="orders"></param>
        /// <param name="criteria"></param>
        /// <returns></returns>
        public static IList<ViewHomeProduct> FindByPage(int curPage,int pagesize,Order[] orders, 
			params Criterion[] criteria)
        {
            IList<ViewHomeProduct> list = new List<ViewHomeProduct>();
            using (DbSession ss = DbManager.Current.OpenSession())
            {
                DbManager.Current.Query(ss,list, curPage, pagesize, orders, criteria);
                return list;
            }
        }
		
		/// <summary>
        /// 根据条件分页查询
        /// </summary>
        /// <param name="orders"></param>
        /// <param name="criteria"></param>
        /// <returns></returns>
        public static IList<ViewHomeProduct> FindByPage(int curPage,int pagesize,params Criterion[] criteria)
        {
			return FindByPage(curPage,pagesize,new Order[0],criteria);
		}
		
		/// <summary>
        /// 根据条件分页查询
        /// </summary>
        /// <param name="orders"></param>
        /// <param name="criteria"></param>
        /// <returns></returns>
        public static IList<ViewHomeProduct> FindByPage(int curPage,int pagesize,Order[] orders, 
			DbSession ss ,params Criterion[] criteria)
        {
            IList<ViewHomeProduct> list = new List<ViewHomeProduct>();
            
            DbManager.Current.Query(ss,list, curPage, pagesize, orders, criteria);
            return list;
        }
		
		/// <summary>
        /// 根据条件分页查询
        /// </summary>
        /// <param name="orders"></param>
        /// <param name="criteria"></param>
        /// <returns></returns>
        public static IList<ViewHomeProduct> FindByPage(int curPage,int pagesize,
			DbSession ss ,params Criterion[] criteria)
        {
			return FindByPage(curPage,pagesize,new Order[0],ss,criteria);
		}
	}
}
